/*
 * Package il.ac.biu.cs.grossmm.cpp
 * File SubscriptionInfo.java
 * 
 * This is a part of presence service framework API. 
 * See javadoc for more information.
 *  
 * Copyright (C) 2006 Grossmann Mark
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
package il.ac.biu.cs.grossmm.api.cpp;

import il.ac.biu.cs.grossmm.api.keys.Key;

/**
 * Represents subscription information which consists of
 * <ul>
 * <li> Susbcription identifier
 * <li> Target of the subscription
 * <li> Watcher which receives notifications related to this subscription
 * <li> Status of the subscription
 * <li> Remainig duration of the subscription
 * </ul>
 */
public class SubscriptionInfo extends State {
	protected final String subscriptID;

	protected final Key target;

	protected final String watcher;

	/**
	 * Creates a new subscription information.
	 * 
	 * @param subscriptID
	 *            susbcription identifier
	 * @param watcher
	 *            watcher which receives notifications related to this
	 *            subscription
	 * @param target
	 *            target of the subscription
	 * @param isSuccess
	 *            true if subscription status is a success, false otherwise
	 * @param duration
	 *            remainig duration of the subscription
	 */
	public SubscriptionInfo(String subscriptID, String watcher, Key target,
		boolean isSuccess, int duration)
	{
		super(isSuccess, duration);
		this.watcher = watcher;
		this.subscriptID = subscriptID;
		this.target = target;
	}

	/**
	 * Gets subscription identifier for this subscription
	 * 
	 * @return subscription identifier for this subscription
	 */
	public String getSubscriptID()
	{
		return subscriptID;
	}

	/**
	 * Gets the target of the subscription
	 * 
	 * @return the target of the subscription
	 */
	public Key getTarget()
	{
		return target;
	}

	/**
	 * Gets watcher which receives notifications related to this subscription
	 * 
	 * @return watcher which receives notifications related to this subscription
	 */
	public String getWatcher()
	{
		return watcher;
	}
}
